home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 12 - 1996 / 12.04 Apr 96 / ThreadingAppleEvents.sit / ThreadingAppleEvents / Grant's CGI Code 1.0b13 / Util / ProcessUtil.c < prev    next >
MacBinary  |  1996-01-26  |  8.4 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Fri Jan 26 01:48:07 1996, modified Fri Jan 26 01:48:07 1996, creator 'CWIE', type ASCII, 7834 bytes "ProcessUtil.c" , at 0x1f1a 410 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0d 50 72 6f 63 65 73 | 73 55 74 69 6c 2e 63 00 |..Proces|sUtil.c.|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 00 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 1e 9a 00 | 00 01 9a ad 2e 29 a7 ad |........|.....)..|
|00000060| 2e 29 a7 00 00 04 00 00 | 00 00 00 00 00 00 00 00 |.)......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 29 95 00 00 |........|....)...|
|00000080| 2f 2a 2a 2a 2a 2a 0d 20 | 2a 0d 20 2a 09 50 72 6f |/*****. |*. *.Pro|
|00000090| 63 65 73 73 55 74 69 6c | 2e 63 0d 20 2a 0d 20 2a |cessUtil|.c. *. *|
|000000a0| 09 54 68 69 73 20 69 73 | 20 61 20 73 75 70 70 6f |.This is| a suppo|
|000000b0| 72 74 20 66 69 6c 65 20 | 66 6f 72 20 22 47 72 61 |rt file |for "Gra|
|000000c0| 6e 74 27 73 20 43 47 49 | 20 46 72 61 6d 65 77 6f |nt's CGI| Framewo|
|000000d0| 72 6b 22 2e 0d 20 2a 09 | 50 6c 65 61 73 65 20 73 |rk".. *.|Please s|
|000000e0| 65 65 20 74 68 65 20 6c | 69 63 65 6e 73 65 20 61 |ee the l|icense a|
|000000f0| 67 72 65 65 6d 65 6e 74 | 20 74 68 61 74 20 61 63 |greement| that ac|
|00000100| 63 6f 6d 70 61 6e 69 65 | 73 20 74 68 65 20 64 69 |companie|s the di|
|00000110| 73 74 72 69 62 75 74 69 | 6f 6e 20 70 61 63 6b 61 |stributi|on packa|
|00000120| 67 65 0d 20 2a 09 66 6f | 72 20 6c 69 63 65 6e 73 |ge. *.fo|r licens|
|00000130| 69 6e 67 20 64 65 74 61 | 69 6c 73 2e 0d 20 2a 0d |ing deta|ils.. *.|
|00000140| 20 2a 09 43 6f 70 79 72 | 69 67 68 74 20 a9 31 39 | *.Copyr|ight .19|
|00000150| 39 35 20 62 79 20 47 72 | 61 6e 74 20 4e 65 75 66 |95 by Gr|ant Neuf|
|00000160| 65 6c 64 0d 20 2a 09 67 | 72 61 6e 74 40 61 63 6d |eld. *.g|rant@acm|
|00000170| 2e 63 6f 6d 0d 20 2a 09 | 68 74 74 70 3a 2f 2f 61 |.com. *.|http://a|
|00000180| 72 70 70 31 2e 63 61 72 | 6c 65 74 6f 6e 2e 63 61 |rpp1.car|leton.ca|
|00000190| 2f 67 72 61 6e 74 2f 0d | 20 2a 0d 20 2a 2a 2a 2a |/grant/.| *. ****|
|000001a0| 2a 2f 0d 0d 23 69 6e 63 | 6c 75 64 65 20 22 4d 79 |*/..#inc|lude "My|
|000001b0| 43 6f 6e 66 69 67 75 72 | 61 74 69 6f 6e 2e 68 22 |Configur|ation.h"|
|000001c0| 0d 0d 23 69 6e 63 6c 75 | 64 65 20 3c 54 68 72 65 |..#inclu|de <Thre|
|000001d0| 61 64 73 2e 68 3e 0d 0d | 23 69 6e 63 6c 75 64 65 |ads.h>..|#include|
|000001e0| 20 22 63 6f 6d 70 69 6c | 65 72 5f 73 74 75 66 66 | "compil|er_stuff|
|000001f0| 2e 68 22 0d 23 69 6e 63 | 6c 75 64 65 20 22 67 6c |.h".#inc|lude "gl|
|00000200| 6f 62 61 6c 73 2e 68 22 | 0d 0d 23 69 6e 63 6c 75 |obals.h"|..#inclu|
|00000210| 64 65 20 22 44 65 62 75 | 67 55 74 69 6c 2e 68 22 |de "Debu|gUtil.h"|
|00000220| 0d 0d 23 69 6e 63 6c 75 | 64 65 20 22 50 72 6f 63 |..#inclu|de "Proc|
|00000230| 65 73 73 55 74 69 6c 2e | 68 22 0d 0d 0d 2f 2a 2a |essUtil.|h".../**|
|00000240| 2a 20 20 4c 4f 43 41 4c | 20 4d 41 43 52 4f 53 20 |* LOCAL| MACROS |
|00000250| 20 2a 2a 2a 2f 0d 0d 2f | 2f 23 64 65 66 69 6e 65 | ***/../|/#define|
|00000260| 20 74 68 72 65 61 64 53 | 6c 65 65 70 49 64 78 49 | threadS|leepIdxI|
|00000270| 6e 63 72 28 29 09 28 28 | 67 54 68 72 65 61 64 53 |ncr().((|gThreadS|
|00000280| 6c 65 65 70 65 72 49 6e | 64 65 78 20 3c 20 6b 53 |leeperIn|dex < kS|
|00000290| 74 61 72 74 75 70 54 68 | 72 65 61 64 73 50 72 65 |tartupTh|readsPre|
|000002a0| 61 6c 6c 6f 63 61 74 65 | 29 3f 20 2b 2b 67 54 68 |allocate|)? ++gTh|
|000002b0| 72 65 61 64 53 6c 65 65 | 70 65 72 49 6e 64 65 78 |readSlee|perIndex|
|000002c0| 20 3a 20 67 54 68 72 65 | 61 64 53 6c 65 65 70 65 | : gThre|adSleepe|
|000002d0| 72 49 6e 64 65 78 20 3d | 20 30 29 29 0d 0d 0d 2f |rIndex =| 0)).../|
|000002e0| 2a 2a 2a 20 20 4c 4f 43 | 41 4c 20 50 52 4f 54 4f |*** LOC|AL PROTO|
|000002f0| 54 59 50 45 53 20 20 2a | 2a 2a 2f 0d 0d 70 61 73 |TYPES *|**/..pas|
|00000300| 63 61 6c 20 76 6f 69 64 | 09 09 6d 79 54 68 72 65 |cal void|..myThre|
|00000310| 61 64 54 65 72 6d 69 6e | 61 74 69 6f 6e 09 28 20 |adTermin|ation.( |
|00000320| 54 68 72 65 61 64 49 44 | 2c 20 76 6f 69 64 20 2a |ThreadID|, void *|
|00000330| 20 29 3b 0d 0d 0d 2f 2a | 2a 2a 20 20 46 55 4e 43 | );.../*|** FUNC|
|00000340| 54 49 4f 4e 53 20 20 2a | 2a 2a 2f 0d 0d 2f 2a 20 |TIONS *|**/../* |
|00000350| 44 65 74 65 72 6d 69 6e | 65 20 69 66 20 74 68 65 |Determin|e if the|
|00000360| 20 63 75 72 72 65 6e 74 | 20 61 70 70 6c 69 63 61 | current| applica|
|00000370| 74 69 6f 6e 20 69 73 20 | 61 63 74 69 76 65 20 28 |tion is |active (|
|00000380| 69 73 20 69 6e 20 66 72 | 6f 6e 74 20 6f 66 20 61 |is in fr|ont of a|
|00000390| 6c 6c 20 6f 74 68 65 72 | 73 29 20 2a 2f 0d 42 6f |ll other|s) */.Bo|
|000003a0| 6f 6c 65 61 6e 0d 50 72 | 6f 63 65 73 73 43 75 72 |olean.Pr|ocessCur|
|000003b0| 72 65 6e 74 49 73 46 72 | 6f 6e 74 20 28 20 76 6f |rentIsFr|ont ( vo|
|000003c0| 69 64 20 29 0d 7b 0d 09 | 23 69 66 20 6b 43 6f 6d |id ).{..|#if kCom|
|000003d0| 70 69 6c 65 57 69 74 68 | 46 6f 72 65 67 72 6f 75 |pileWith|Foregrou|
|000003e0| 6e 64 0d 09 0d 09 42 6f | 6f 6c 65 61 6e 09 09 09 |nd....Bo|olean...|
|000003f0| 09 09 69 73 46 72 6f 6e | 74 3b 0d 09 50 72 6f 63 |..isFron|t;..Proc|
|00000400| 65 73 73 53 65 72 69 61 | 6c 4e 75 6d 62 65 72 09 |essSeria|lNumber.|
|00000410| 09 6d 79 50 53 4e 3b 0d | 09 4f 53 45 72 72 09 09 |.myPSN;.|.OSErr..|
|00000420| 09 09 09 74 68 65 45 72 | 72 3b 0d 09 0d 09 2f 2a |...theEr|r;..../*|
|00000430| 20 67 65 74 20 6d 79 20 | 70 72 6f 63 65 73 73 20 | get my |process |
|00000440| 73 65 72 69 61 6c 20 6e | 75 6d 62 65 72 2e 20 49 |serial n|umber. I|
|00000450| 4d 3a 50 72 6f 63 65 73 | 73 65 73 20 32 2d 32 31 |M:Proces|ses 2-21|
|00000460| 20 2a 2f 0d 09 74 68 65 | 45 72 72 20 3d 20 47 65 | */..the|Err = Ge|
|00000470| 74 43 75 72 72 65 6e 74 | 50 72 6f 63 65 73 73 20 |tCurrent|Process |
|00000480| 28 20 26 6d 79 50 53 4e | 20 29 3b 0d 09 0d 09 69 |( &myPSN| );....i|
|00000490| 66 20 28 20 74 68 65 45 | 72 72 20 21 3d 20 6e 6f |f ( theE|rr != no|
|000004a0| 45 72 72 20 29 0d 09 7b | 0d 09 09 2f 2a 20 6d 69 |Err )..{|.../* mi|
|000004b0| 67 68 74 20 77 61 6e 74 | 20 74 6f 20 64 6f 20 73 |ght want| to do s|
|000004c0| 6f 6d 65 74 68 69 6e 67 | 20 65 6c 73 65 20 68 65 |omething| else he|
|000004d0| 72 65 20 74 6f 20 68 61 | 6e 64 6c 65 20 74 68 65 |re to ha|ndle the|
|000004e0| 20 65 72 72 6f 72 20 2a | 2f 0d 09 09 72 65 74 75 | error *|/...retu|
|000004f0| 72 6e 20 66 61 6c 73 65 | 3b 0d 09 7d 0d 09 0d 09 |rn false|;..}....|
|00000500| 69 73 46 72 6f 6e 74 20 | 3d 20 50 72 6f 63 65 73 |isFront |= Proces|
|00000510| 73 49 73 46 72 6f 6e 74 | 20 28 20 26 6d 79 50 53 |sIsFront| ( &myPS|
|00000520| 4e 20 29 3b 0d 09 0d 09 | 72 65 74 75 72 6e 20 69 |N );....|return i|
|00000530| 73 46 72 6f 6e 74 3b 0d | 09 0d 09 23 65 6c 73 65 |sFront;.|...#else|
|00000540| 09 2f 2a 20 69 66 20 6e | 6f 74 20 6b 43 6f 6d 70 |./* if n|ot kComp|
|00000550| 69 6c 65 57 69 74 68 46 | 6f 72 65 67 72 6f 75 6e |ileWithF|oregroun|
|00000560| 64 20 2a 2f 0d 09 0d 09 | 72 65 74 75 72 6e 20 66 |d */....|return f|
|00000570| 61 6c 73 65 3b 0d 09 0d | 09 23 65 6e 64 69 66 09 |alse;...|.#endif.|
|00000580| 2f 2a 20 6b 43 6f 6d 70 | 69 6c 65 57 69 74 68 46 |/* kComp|ileWithF|
|00000590| 6f 72 65 67 72 6f 75 6e | 64 20 2a 2f 0d 7d 20 2f |oregroun|d */.} /|
|000005a0| 2a 20 50 72 6f 63 65 73 | 73 43 75 72 72 65 6e 74 |* Proces|sCurrent|
|000005b0| 49 73 46 72 6f 6e 74 20 | 2a 2f 0d 0d 0d 2f 2a 20 |IsFront |*/.../* |
|000005c0| 52 75 6e 20 74 68 72 6f | 75 67 68 20 57 61 69 74 |Run thro|ugh Wait|
|000005d0| 4e 65 78 74 45 76 65 6e | 74 2c 20 6e 6f 74 20 68 |NextEven|t, not h|
|000005e0| 61 6e 64 6c 69 6e 67 20 | 65 76 65 6e 74 73 2c 20 |andling |events, |
|000005f0| 75 6e 74 69 6c 20 74 68 | 65 20 70 72 6f 63 65 73 |until th|e proces|
|00000600| 73 20 63 6f 6d 65 73 0d | 09 74 6f 20 74 68 65 20 |s comes.|.to the |
|00000610| 66 6f 72 65 67 72 6f 75 | 6e 64 2e 0d 09 52 65 74 |foregrou|nd...Ret|
|00000620| 75 72 6e 73 20 66 61 6c | 73 65 20 69 66 20 74 69 |urns fal|se if ti|
|00000630| 6d 65 6f 75 74 20 69 73 | 20 72 65 61 63 68 65 64 |meout is| reached|
|00000640| 20 62 65 66 6f 72 65 20 | 70 72 6f 63 65 73 73 20 | before |process |
|00000650| 62 72 6f 75 67 68 74 20 | 74 6f 20 66 72 6f 6e 74 |brought |to front|
|00000660| 2e 0d 09 54 69 6d 65 6f | 75 74 20 69 73 20 69 6e |...Timeo|ut is in|
|00000670| 20 74 69 63 6b 73 20 28 | 36 30 74 68 73 20 6f 66 | ticks (|60ths of|
|00000680| 20 61 20 73 65 63 6f 6e | 64 29 2e 20 49 66 20 74 | a secon|d). If t|
|00000690| 69 6d 65 6f 75 74 20 69 | 73 20 6e 69 6c 20 2d 20 |imeout i|s nil - |
|000006a0| 64 6f 65 73 6e 27 74 20 | 74 69 6d 65 6f 75 74 2e |doesn't |timeout.|
|000006b0| 20 2a 2f 0d 42 6f 6f 6c | 65 61 6e 0d 50 72 6f 63 | */.Bool|ean.Proc|
|000006c0| 65 73 73 57 61 69 74 55 | 6e 74 69 6c 46 72 6f 6e |essWaitU|ntilFron|
|000006d0| 74 20 28 20 75 6e 73 69 | 67 6e 65 64 20 6c 6f 6e |t ( unsi|gned lon|
|000006e0| 67 20 74 69 6d 65 6f 75 | 74 20 29 0d 7b 0d 09 42 |g timeou|t ).{..B|
|000006f0| 6f 6f 6c 65 61 6e 09 09 | 09 69 73 46 72 6f 6e 74 |oolean..|.isFront|
|00000700| 3b 0d 09 6c 6f 6e 67 09 | 09 09 65 6e 64 54 69 6d |;..long.|..endTim|
|00000710| 65 3b 0d 09 6c 6f 6e 67 | 09 09 09 73 6c 65 65 70 |e;..long|...sleep|
|00000720| 54 69 63 6b 73 3b 0d 09 | 45 76 65 6e 74 52 65 63 |Ticks;..|EventRec|
|00000730| 6f 72 64 09 09 74 68 65 | 45 76 65 6e 74 3b 0d 09 |ord..the|Event;..|
|00000740| 0d 09 69 73 46 72 6f 6e | 74 20 3d 20 50 72 6f 63 |..isFron|t = Proc|
|00000750| 65 73 73 43 75 72 72 65 | 6e 74 49 73 46 72 6f 6e |essCurre|ntIsFron|
|00000760| 74 20 28 29 3b 0d 09 0d | 09 69 66 20 28 20 21 69 |t ();...|.if ( !i|
|00000770| 73 46 72 6f 6e 74 20 29 | 0d 09 7b 0d 09 09 65 6e |sFront )|..{...en|
|00000780| 64 54 69 6d 65 20 3d 20 | 54 69 63 6b 43 6f 75 6e |dTime = |TickCoun|
|00000790| 74 28 29 20 2b 20 74 69 | 6d 65 6f 75 74 3b 0d 09 |t() + ti|meout;..|
|000007a0| 09 0d 09 09 69 66 20 28 | 20 28 74 69 6d 65 6f 75 |....if (| (timeou|
|000007b0| 74 20 3e 20 32 30 29 20 | 7c 7c 20 28 74 69 6d 65 |t > 20) ||| (time|
|000007c0| 6f 75 74 20 3d 3d 20 6e | 69 6c 29 20 29 0d 09 09 |out == n|il) )...|
|000007d0| 7b 0d 09 09 09 73 6c 65 | 65 70 54 69 63 6b 73 20 |{....sle|epTicks |
|000007e0| 3d 20 32 30 3b 0d 09 09 | 7d 0d 09 09 65 6c 73 65 |= 20;...|}...else|
|000007f0| 0d 09 09 7b 0d 09 09 09 | 73 6c 65 65 70 54 69 63 |...{....|sleepTic|
|00000800| 6b 73 20 3d 20 74 69 6d | 65 6f 75 74 3b 0d 09 09 |ks = tim|eout;...|
|00000810| 7d 0d 09 09 0d 09 09 64 | 6f 0d 09 09 7b 0d 09 09 |}......d|o...{...|
|00000820| 09 57 61 69 74 4e 65 78 | 74 45 76 65 6e 74 20 28 |.WaitNex|tEvent (|
|00000830| 20 6e 69 6c 2c 20 26 74 | 68 65 45 76 65 6e 74 2c | nil, &t|heEvent,|
|00000840| 20 73 6c 65 65 70 54 69 | 63 6b 73 2c 20 6e 69 6c | sleepTi|cks, nil|
|00000850| 20 29 3b 0d 09 09 09 0d | 09 09 09 69 73 46 72 6f | );.....|...isFro|
|00000860| 6e 74 20 3d 20 50 72 6f | 63 65 73 73 43 75 72 72 |nt = Pro|cessCurr|
|00000870| 65 6e 74 49 73 46 72 6f | 6e 74 20 28 29 3b 0d 09 |entIsFro|nt ();..|
|00000880| 09 7d 20 77 68 69 6c 65 | 20 28 20 21 69 73 46 72 |.} while| ( !isFr|
|00000890| 6f 6e 74 20 26 26 20 28 | 28 74 69 6d 65 6f 75 74 |ont && (|(timeout|
|000008a0| 20 3d 3d 20 6e 69 6c 29 | 20 7c 7c 20 28 65 6e 64 | == nil)| || (end|
|000008b0| 54 69 6d 65 20 3e 3d 20 | 54 69 63 6b 43 6f 75 6e |Time >= |TickCoun|
|000008c0| 74 28 29 29 29 20 29 3b | 0d 09 7d 0d 09 0d 09 72 |t())) );|..}....r|
|000008d0| 65 74 75 72 6e 20 69 73 | 46 72 6f 6e 74 3b 0d 7d |eturn is|Front;.}|
|000008e0| 20 2f 2a 20 50 72 6f 63 | 65 73 73 57 61 69 74 55 | /* Proc|essWaitU|
|000008f0| 6e 74 69 6c 46 72 6f 6e | 74 20 2a 2f 0d 0d 0d 2f |ntilFron|t */.../|
|00000900| 2a 20 44 65 74 65 72 6d | 69 6e 65 20 69 66 20 74 |* Determ|ine if t|
|00000910| 68 65 20 73 70 65 63 69 | 66 69 65 64 20 61 70 70 |he speci|fied app|
|00000920| 6c 69 63 61 74 69 6f 6e | 20 69 73 20 61 63 74 69 |lication| is acti|
|00000930| 76 65 20 28 69 73 20 69 | 6e 20 66 72 6f 6e 74 20 |ve (is i|n front |
|00000940| 6f 66 20 61 6c 6c 20 6f | 74 68 65 72 73 29 20 2a |of all o|thers) *|
|00000950| 2f 0d 42 6f 6f 6c 65 61 | 6e 0d 50 72 6f 63 65 73 |/.Boolea|n.Proces|
|00000960| 73 49 73 46 72 6f 6e 74 | 20 28 20 50 72 6f 63 65 |sIsFront| ( Proce|
|00000970| 73 73 53 65 72 69 61 6c | 4e 75 6d 62 65 72 20 2a |ssSerial|Number *|
|00000980| 74 68 65 50 53 4e 20 29 | 0d 7b 0d 09 4f 53 45 72 |thePSN )|.{..OSEr|
|00000990| 72 09 09 09 09 09 74 68 | 65 45 72 72 3b 0d 09 50 |r.....th|eErr;..P|
|000009a0| 72 6f 63 65 73 73 53 65 | 72 69 61 6c 4e 75 6d 62 |rocessSe|rialNumb|
|000009b0| 65 72 09 09 66 72 6f 6e | 74 50 53 4e 3b 0d 09 0d |er..fron|tPSN;...|
|000009c0| 09 6d 79 5f 61 73 73 65 | 72 74 20 28 20 74 68 65 |.my_asse|rt ( the|
|000009d0| 50 53 4e 20 21 3d 20 6e | 69 6c 2c 20 22 5c 70 50 |PSN != n|il, "\pP|
|000009e0| 72 6f 63 65 73 73 49 73 | 46 72 6f 6e 74 3a 20 74 |rocessIs|Front: t|
|000009f0| 68 65 50 53 4e 20 70 74 | 72 20 69 73 20 6e 69 6c |hePSN pt|r is nil|
|00000a00| 22 20 29 3b 0d 09 0d 09 | 74 68 65 45 72 72 20 3d |" );....|theErr =|
|00000a10| 20 47 65 74 46 72 6f 6e | 74 50 72 6f 63 65 73 73 | GetFron|tProcess|
|00000a20| 20 28 20 26 66 72 6f 6e | 74 50 53 4e 20 29 3b 0d | ( &fron|tPSN );.|
|00000a30| 09 0d 09 69 66 20 28 20 | 74 68 65 45 72 72 20 21 |...if ( |theErr !|
|00000a40| 3d 20 6e 6f 45 72 72 20 | 29 0d 09 7b 0d 09 09 2f |= noErr |)..{.../|
|00000a50| 2a 20 6d 69 67 68 74 20 | 77 61 6e 74 20 74 6f 20 |* might |want to |
|00000a60| 64 6f 20 73 6f 6d 65 74 | 68 69 6e 67 20 65 6c 73 |do somet|hing els|
|00000a70| 65 20 68 65 72 65 20 74 | 6f 20 68 61 6e 64 6c 65 |e here t|o handle|
|00000a80| 20 74 68 65 20 65 72 72 | 6f 72 20 2a 2f 0d 09 09 | the err|or */...|
|00000a90| 72 65 74 75 72 6e 20 66 | 61 6c 73 65 3b 0d 09 7d |return f|alse;..}|
|00000aa0| 0d 09 0d 09 72 65 74 75 | 72 6e 20 28 20 28 66 72 |....retu|rn ( (fr|
|00000ab0| 6f 6e 74 50 53 4e 2e 6c | 6f 77 4c 6f 6e 67 4f 66 |ontPSN.l|owLongOf|
|00000ac0| 50 53 4e 20 3d 3d 20 74 | 68 65 50 53 4e 2d 3e 6c |PSN == t|hePSN->l|
|00000ad0| 6f 77 4c 6f 6e 67 4f 66 | 50 53 4e 29 20 26 26 0d |owLongOf|PSN) &&.|
|00000ae0| 09 09 28 66 72 6f 6e 74 | 50 53 4e 2e 68 69 67 68 |..(front|PSN.high|
|00000af0| 4c 6f 6e 67 4f 66 50 53 | 4e 20 3d 3d 20 74 68 65 |LongOfPS|N == the|
|00000b00| 50 53 4e 2d 3e 68 69 67 | 68 4c 6f 6e 67 4f 66 50 |PSN->hig|hLongOfP|
|00000b10| 53 4e 29 20 29 3b 0d 7d | 20 2f 2a 20 50 72 6f 63 |SN) );.}| /* Proc|
|00000b20| 65 73 73 49 73 46 72 6f | 6e 74 20 2a 2f 0d 0d 0d |essIsFro|nt */...|
|00000b30| 2f 2a 20 46 69 6c 6c 20 | 6f 75 74 20 61 6e 20 61 |/* Fill |out an a|
|00000b40| 6c 72 65 61 64 79 20 61 | 6c 6c 6f 63 61 74 65 64 |lready a|llocated|
|00000b50| 20 46 53 53 70 65 63 20 | 77 69 74 68 20 74 68 65 | FSSpec |with the|
|00000b60| 20 63 75 72 72 65 6e 74 | 20 70 72 6f 63 65 73 73 | current| process|
|00000b70| 27 20 6c 6f 63 61 74 69 | 6f 6e 2e 0d 09 54 68 61 |' locati|on...Tha|
|00000b80| 6e 6b 73 20 74 6f 20 47 | 72 65 67 6f 72 79 20 53 |nks to G|regory S|
|00000b90| 2e 20 43 6f 6d 62 73 20 | 66 6f 72 20 70 72 6f 76 |. Combs |for prov|
|00000ba0| 69 64 69 6e 67 20 6d 6f | 73 74 20 6f 66 20 74 68 |iding mo|st of th|
|00000bb0| 69 73 20 66 75 6e 63 74 | 69 6f 6e 2e 20 2a 2f 0d |is funct|ion. */.|
|00000bc0| 4f 53 45 72 72 0d 50 72 | 6f 63 65 73 73 47 65 74 |OSErr.Pr|ocessGet|
|00000bd0| 4d 79 46 53 53 70 65 63 | 20 28 20 46 53 53 70 65 |MyFSSpec| ( FSSpe|
|00000be0| 63 20 2a 70 72 6f 63 46 | 69 6c 65 53 70 65 63 20 |c *procF|ileSpec |
|00000bf0| 29 0d 7b 0d 09 4f 53 45 | 72 72 09 09 09 09 09 74 |).{..OSE|rr.....t|
|00000c00| 68 65 45 72 72 3b 0d 09 | 50 72 6f 63 65 73 73 53 |heErr;..|ProcessS|
|00000c10| 65 72 69 61 6c 4e 75 6d | 62 65 72 09 09 63 75 72 |erialNum|ber..cur|
|00000c20| 50 53 4e 3b 0d 09 50 72 | 6f 63 65 73 73 49 6e 66 |PSN;..Pr|ocessInf|
|00000c30| 6f 52 65 63 09 09 09 70 | 72 6f 63 49 6e 66 6f 3b |oRec...p|rocInfo;|
|00000c40| 0d 09 53 74 72 32 35 35 | 09 09 09 09 09 61 70 70 |..Str255|.....app|
|00000c50| 4e 61 6d 65 3b 0d 09 0d | 09 6d 79 5f 61 73 73 65 |Name;...|.my_asse|
|00000c60| 72 74 20 28 20 70 72 6f | 63 46 69 6c 65 53 70 65 |rt ( pro|cFileSpe|
|00000c70| 63 20 21 3d 20 6e 69 6c | 2c 20 22 5c 70 50 72 6f |c != nil|, "\pPro|
|00000c80| 63 65 73 73 47 65 74 4d | 79 46 53 53 70 65 63 3a |cessGetM|yFSSpec:|
|00000c90| 20 70 72 6f 63 46 69 6c | 65 53 70 65 63 20 70 74 | procFil|eSpec pt|
|00000ca0| 72 20 69 73 20 6e 69 6c | 22 20 29 3b 0d 09 0d 09 |r is nil|" );....|
|00000cb0| 74 68 65 45 72 72 20 3d | 20 47 65 74 43 75 72 72 |theErr =| GetCurr|
|00000cc0| 65 6e 74 50 72 6f 63 65 | 73 73 20 28 20 26 63 75 |entProce|ss ( &cu|
|00000cd0| 72 50 53 4e 20 29 3b 0d | 09 0d 09 69 66 20 28 20 |rPSN );.|...if ( |
|00000ce0| 74 68 65 45 72 72 20 3d | 3d 20 6e 6f 45 72 72 20 |theErr =|= noErr |
|00000cf0| 29 0d 09 7b 0d 09 09 70 | 72 6f 63 49 6e 66 6f 2e |)..{...p|rocInfo.|
|00000d00| 70 72 6f 63 65 73 73 49 | 6e 66 6f 4c 65 6e 67 74 |processI|nfoLengt|
|00000d10| 68 09 3d 20 73 69 7a 65 | 6f 66 20 28 20 50 72 6f |h.= size|of ( Pro|
|00000d20| 63 65 73 73 49 6e 66 6f | 52 65 63 20 29 3b 0d 09 |cessInfo|Rec );..|
|00000d30| 09 70 72 6f 63 49 6e 66 | 6f 2e 70 72 6f 63 65 73 |.procInf|o.proces|
|00000d40| 73 4e 61 6d 65 09 09 3d | 20 61 70 70 4e 61 6d 65 |sName..=| appName|
|00000d50| 3b 0d 09 09 70 72 6f 63 | 49 6e 66 6f 2e 70 72 6f |;...proc|Info.pro|
|00000d60| 63 65 73 73 41 70 70 53 | 70 65 63 09 09 3d 20 70 |cessAppS|pec..= p|
|00000d70| 72 6f 63 46 69 6c 65 53 | 70 65 63 3b 0d 09 09 0d |rocFileS|pec;....|
|00000d80| 09 09 74 68 65 45 72 72 | 20 3d 20 47 65 74 50 72 |..theErr| = GetPr|
|00000d90| 6f 63 65 73 73 49 6e 66 | 6f 72 6d 61 74 69 6f 6e |ocessInf|ormation|
|00000da0| 20 28 20 26 63 75 72 50 | 53 4e 2c 20 26 70 72 6f | ( &curP|SN, &pro|
|00000db0| 63 49 6e 66 6f 20 29 3b | 0d 09 7d 0d 09 0d 09 72 |cInfo );|..}....r|
|00000dc0| 65 74 75 72 6e 20 74 68 | 65 45 72 72 3b 0d 7d 20 |eturn th|eErr;.} |
|00000dd0| 2f 2a 20 50 72 6f 63 65 | 73 73 47 65 74 4d 79 46 |/* Proce|ssGetMyF|
|00000de0| 53 53 70 65 63 20 2a 2f | 0d 0d 0d 2f 2a 2a 20 20 |SSpec */|.../** |
|00000df0| 54 48 52 45 41 44 20 46 | 55 4e 43 54 49 4f 4e 53 |THREAD F|UNCTIONS|
|00000e00| 20 20 2a 2a 2f 0d 23 70 | 72 61 67 6d 61 20 6d 61 | **/.#p|ragma ma|
|00000e10| 72 6b 20 2d 0d 0d 2f 2a | 20 41 6c 6c 6f 63 61 74 |rk -../*| Allocat|
|00000e20| 65 20 61 20 6e 65 77 20 | 74 68 72 65 61 64 20 66 |e a new |thread f|
|00000e30| 72 6f 6d 20 74 68 65 20 | 65 78 69 73 74 69 6e 67 |rom the |existing|
|00000e40| 20 70 6f 6f 6c 20 6f 66 | 20 74 68 72 65 61 64 73 | pool of| threads|
|00000e50| 2e 0d 09 49 66 20 74 68 | 65 72 65 20 61 72 65 20 |...If th|ere are |
|00000e60| 6e 6f 20 74 68 72 65 61 | 64 73 20 61 76 61 69 6c |no threa|ds avail|
|00000e70| 61 62 6c 65 2c 20 79 69 | 65 6c 64 20 74 6f 20 6f |able, yi|eld to o|
|00000e80| 74 68 65 72 20 74 68 72 | 65 61 64 73 20 75 6e 74 |ther thr|eads unt|
|00000e90| 69 6c 20 6f 6e 65 20 66 | 69 6e 69 73 68 65 73 2e |il one f|inishes.|
|00000ea0| 0d 09 54 68 65 20 54 68 | 72 65 61 64 20 4d 61 6e |..The Th|read Man|
|00000eb0| 61 67 65 72 20 6d 75 73 | 74 20 62 65 20 61 76 61 |ager mus|t be ava|
|00000ec0| 69 6c 61 62 6c 65 20 66 | 6f 72 20 74 68 69 73 20 |ilable f|or this |
|00000ed0| 66 75 6e 63 74 69 6f 6e | 20 74 6f 20 77 6f 72 6b |function| to work|
|00000ee0| 2e 20 2a 2f 0d 23 69 66 | 20 6b 53 74 61 72 74 75 |. */.#if| kStartu|
|00000ef0| 70 54 68 72 65 61 64 73 | 50 72 65 61 6c 6c 6f 63 |pThreads|Prealloc|
|00000f00| 61 74 65 20 3e 20 6e 69 | 6c 0d 4f 53 45 72 72 0d |ate > ni|l.OSErr.|
|00000f10| 4d 79 4e 65 77 54 68 72 | 65 61 64 46 72 6f 6d 50 |MyNewThr|eadFromP|
|00000f20| 6f 6f 6c 20 28 0d 09 54 | 68 72 65 61 64 45 6e 74 |ool (..T|hreadEnt|
|00000f30| 72 79 50 72 6f 63 50 74 | 72 09 74 68 72 65 61 64 |ryProcPt|r.thread|
|00000f40| 45 6e 74 72 79 2c 0d 09 | 76 6f 69 64 20 2a 09 09 |Entry,..|void *..|
|00000f50| 09 09 74 68 72 65 61 64 | 50 61 72 61 6d 2c 0d 09 |..thread|Param,..|
|00000f60| 76 6f 69 64 20 2a 2a 09 | 09 09 09 74 68 72 65 61 |void **.|...threa|
|00000f70| 64 52 65 73 75 6c 74 2c | 0d 09 54 68 72 65 61 64 |dResult,|..Thread|
|00000f80| 49 44 20 2a 09 09 09 74 | 68 72 65 61 64 4d 61 64 |ID *...t|hreadMad|
|00000f90| 65 20 29 0d 7b 0d 09 4f | 53 45 72 72 09 09 74 68 |e ).{..O|SErr..th|
|00000fa0| 65 45 72 72 3b 0d 09 73 | 68 6f 72 74 09 09 74 68 |eErr;..s|hort..th|
|00000fb0| 72 65 61 64 73 46 72 65 | 65 3b 0d 09 54 68 72 65 |readsFre|e;..Thre|
|00000fc0| 61 64 49 44 09 63 75 72 | 72 65 6e 74 54 68 72 65 |adID.cur|rentThre|
|00000fd0| 61 64 3b 0d 09 0d 09 23 | 69 66 20 6b 43 6f 6d 70 |ad;....#|if kComp|
|00000fe0| 69 6c 65 57 69 74 68 54 | 68 72 65 61 64 73 4f 70 |ileWithT|hreadsOp|
|00000ff0| 74 69 6f 6e 61 6c 0d 09 | 6d 79 5f 61 73 73 65 72 |tional..|my_asser|
|00001000| 74 20 28 20 67 48 61 73 | 54 68 72 65 61 64 4d 67 |t ( gHas|ThreadMg|
|00001010| 72 2c 20 22 5c 70 4d 79 | 4e 65 77 54 68 72 65 61 |r, "\pMy|NewThrea|
|00001020| 64 46 72 6f 6d 50 6f 6f | 6c 3a 20 54 68 72 65 61 |dFromPoo|l: Threa|
|00001030| 64 20 4d 61 6e 61 67 65 | 72 20 6e 6f 74 20 61 76 |d Manage|r not av|
|00001040| 61 69 6c 61 62 6c 65 22 | 20 29 3b 0d 09 23 65 6e |ailable"| );..#en|
|00001050| 64 69 66 0d 09 6d 79 5f | 61 73 73 65 72 74 20 28 |dif..my_|assert (|
|00001060| 20 67 54 68 72 65 61 64 | 53 6c 65 65 70 65 72 20 | gThread|Sleeper |
|00001070| 3d 3d 20 6e 69 6c 2c 20 | 22 5c 70 4d 79 4e 65 77 |== nil, |"\pMyNew|
|00001080| 54 68 72 65 61 64 46 72 | 6f 6d 50 6f 6f 6c 3a 20 |ThreadFr|omPool: |
|00001090| 67 54 68 72 65 61 64 53 | 6c 65 65 70 65 72 20 69 |gThreadS|leeper i|
|000010a0| 73 20 6e 6f 74 20 6e 69 | 6c 22 20 29 3b 0d 09 0d |s not ni|l" );...|
|000010b0| 09 74 68 65 45 72 72 20 | 3d 20 47 65 74 46 72 65 |.theErr |= GetFre|
|000010c0| 65 54 68 72 65 61 64 43 | 6f 75 6e 74 20 28 20 6b |eThreadC|ount ( k|
|000010d0| 43 6f 6f 70 65 72 61 74 | 69 76 65 54 68 72 65 61 |Cooperat|iveThrea|
|000010e0| 64 2c 20 26 74 68 72 65 | 61 64 73 46 72 65 65 20 |d, &thre|adsFree |
|000010f0| 29 3b 0d 09 69 66 20 28 | 20 74 68 65 45 72 72 20 |);..if (| theErr |
|00001100| 3d 3d 20 6e 6f 45 72 72 | 20 29 0d 09 7b 0d 09 09 |== noErr| )..{...|
|00001110| 74 68 65 45 72 72 20 3d | 20 47 65 74 43 75 72 72 |theErr =| GetCurr|
|00001120| 65 6e 74 54 68 72 65 61 | 64 20 28 20 26 63 75 72 |entThrea|d ( &cur|
|00001130| 72 65 6e 74 54 68 72 65 | 61 64 20 29 3b 0d 09 7d |rentThre|ad );..}|
|00001140| 0d 09 0d 09 69 66 20 28 | 20 28 74 68 65 45 72 72 |....if (| (theErr|
|00001150| 20 3d 3d 20 6e 6f 45 72 | 72 29 20 26 26 20 28 74 | == noEr|r) && (t|
|00001160| 68 72 65 61 64 73 46 72 | 65 65 20 3d 3d 20 6e 69 |hreadsFr|ee == ni|
|00001170| 6c 29 20 29 0d 09 7b 0d | 09 09 2f 2a 20 50 75 74 |l) )..{.|../* Put|
|00001180| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 74 68 72 | the cur|rent thr|
|00001190| 65 61 64 20 74 6f 20 73 | 6c 65 65 70 2c 20 74 6f |ead to s|leep, to|
|000011a0| 20 62 65 20 77 6f 6b 65 | 6e 20 75 70 20 77 68 65 | be woke|n up whe|
|000011b0| 6e 20 61 20 74 68 72 65 | 61 64 0d 09 09 09 62 65 |n a thre|ad....be|
|000011c0| 63 6f 6d 65 73 20 61 76 | 61 69 6c 61 62 6c 65 2e |comes av|ailable.|
|000011d0| 20 2a 2f 0d 09 09 67 54 | 68 72 65 61 64 53 6c 65 | */...gT|hreadSle|
|000011e0| 65 70 65 72 20 3d 20 63 | 75 72 72 65 6e 74 54 68 |eper = c|urrentTh|
|000011f0| 72 65 61 64 3b 0d 09 09 | 74 68 65 45 72 72 20 3d |read;...|theErr =|
|00001200| 20 53 65 74 54 68 72 65 | 61 64 53 74 61 74 65 20 | SetThre|adState |
|00001210| 28 20 63 75 72 72 65 6e | 74 54 68 72 65 61 64 2c |( curren|tThread,|
|00001220| 20 6b 53 74 6f 70 70 65 | 64 54 68 72 65 61 64 53 | kStoppe|dThreadS|
|00001230| 74 61 74 65 2c 20 6e 69 | 6c 20 29 3b 0d 09 09 69 |tate, ni|l );...i|
|00001240| 66 20 28 20 74 68 65 45 | 72 72 20 21 3d 20 6e 6f |f ( theE|rr != no|
|00001250| 45 72 72 20 29 0d 09 09 | 7b 0d 09 09 09 2f 2a 20 |Err )...|{..../* |
|00001260| 63 6f 75 6c 64 6e 27 74 | 20 70 75 74 20 74 68 72 |couldn't| put thr|
|00001270| 65 61 64 20 74 6f 20 73 | 6c 65 65 70 20 2a 2f 0d |ead to s|leep */.|
|00001280| 09 09 7d 0d 09 7d 0d 09 | 0d 2f 2f 09 2f 2a 20 77 |..}..}..|.//./* w|
|00001290| 68 69 6c 65 20 74 68 65 | 72 65 20 69 73 20 6e 6f |hile the|re is no|
|000012a0| 20 65 72 72 6f 72 2c 20 | 61 6e 64 20 74 68 65 72 | error, |and ther|
|000012b0| 65 20 61 72 65 20 6e 6f | 20 74 68 72 65 61 64 73 |e are no| threads|
|000012c0| 20 66 72 65 65 2c 20 2a | 2f 0d 2f 2f 09 77 68 69 | free, *|/.//.whi|
|000012d0| 6c 65 20 28 20 28 74 68 | 65 45 72 72 20 3d 3d 20 |le ( (th|eErr == |
|000012e0| 6e 6f 45 72 72 29 20 26 | 26 20 28 74 68 72 65 61 |noErr) &|& (threa|
|000012f0| 64 73 46 72 65 65 20 3c | 3d 20 6e 69 6c 29 20 29 |dsFree <|= nil) )|
|00001300| 0d 2f 2f 09 7b 0d 2f 2f | 09 09 2f 2a 20 67 69 76 |.//.{.//|../* giv|
|00001310| 65 20 6f 74 68 65 72 20 | 74 68 72 65 61 64 73 20 |e other |threads |
|00001320| 61 20 63 68 61 6e 63 65 | 20 74 6f 20 63 6f 6d 70 |a chance| to comp|
|00001330| 6c 65 74 65 20 2a 2f 0d | 2f 2f 09 09 59 69 65 6c |lete */.|//..Yiel|
|00001340| 64 54 6f 41 6e 79 54 68 | 72 65 61 64 20 28 29 3b |dToAnyTh|read ();|
|00001350| 0d 2f 2f 09 09 0d 2f 2f | 09 09 2f 2a 20 63 68 65 |.//...//|../* che|
|00001360| 63 6b 20 69 66 20 61 6e | 79 20 6f 74 68 65 72 20 |ck if an|y other |
|00001370| 74 68 72 65 61 64 73 20 | 64 69 64 20 63 6f 6d 70 |threads |did comp|
|00001380| 6c 65 74 65 20 2a 2f 0d | 2f 2f 09 09 74 68 65 45 |lete */.|//..theE|
|00001390| 72 72 20 3d 20 47 65 74 | 46 72 65 65 54 68 72 65 |rr = Get|FreeThre|
|000013a0| 61 64 43 6f 75 6e 74 20 | 28 20 6b 43 6f 6f 70 65 |adCount |( kCoope|
|000013b0| 72 61 74 69 76 65 54 68 | 72 65 61 64 2c 20 26 74 |rativeTh|read, &t|
|000013c0| 68 72 65 61 64 73 46 72 | 65 65 20 29 3b 0d 2f 2f |hreadsFr|ee );.//|
|000013d0| 09 7d 0d 09 0d 09 69 66 | 20 28 20 74 68 65 45 72 |.}....if| ( theEr|
|000013e0| 72 20 3d 3d 20 6e 6f 45 | 72 72 20 29 0d 09 7b 0d |r == noE|rr )..{.|
|000013f0| 09 09 2f 2a 20 49 6e 73 | 74 61 6c 6c 20 74 68 65 |../* Ins|tall the|
|00001400| 20 6e 65 77 20 74 68 72 | 65 61 64 20 75 73 69 6e | new thr|ead usin|
|00001410| 67 20 61 20 70 72 65 6d | 61 64 65 20 74 68 72 65 |g a prem|ade thre|
|00001420| 61 64 20 66 72 6f 6d 20 | 74 68 65 20 70 6f 6f 6c |ad from |the pool|
|00001430| 2e 20 2a 2f 0d 09 09 74 | 68 65 45 72 72 20 3d 20 |. */...t|heErr = |
|00001440| 4e 65 77 54 68 72 65 61 | 64 20 28 20 6b 43 6f 6f |NewThrea|d ( kCoo|
|00001450| 70 65 72 61 74 69 76 65 | 54 68 72 65 61 64 2c 20 |perative|Thread, |
|00001460| 74 68 72 65 61 64 45 6e | 74 72 79 2c 20 74 68 72 |threadEn|try, thr|
|00001470| 65 61 64 50 61 72 61 6d | 2c 20 6e 69 6c 2c 0d 09 |eadParam|, nil,..|
|00001480| 09 09 6b 46 50 55 4e 6f | 74 4e 65 65 64 65 64 20 |..kFPUNo|tNeeded |
|00001490| 2b 20 6b 55 73 65 50 72 | 65 6d 61 64 65 54 68 72 |+ kUsePr|emadeThr|
|000014a0| 65 61 64 2c 20 74 68 72 | 65 61 64 52 65 73 75 6c |ead, thr|eadResul|
|000014b0| 74 2c 20 74 68 72 65 61 | 64 4d 61 64 65 20 29 3b |t, threa|dMade );|
|000014c0| 0d 09 7d 0d 09 0d 09 69 | 66 20 28 20 74 68 65 45 |..}....i|f ( theE|
|000014d0| 72 72 20 3d 3d 20 6e 6f | 45 72 72 20 29 0d 09 7b |rr == no|Err )..{|
|000014e0| 0d 09 09 2f 2a 20 73 65 | 74 20 74 68 65 20 74 65 |.../* se|t the te|
|000014f0| 72 6d 69 6e 61 74 69 6f | 6e 20 66 75 6e 63 74 69 |rminatio|n functi|
|00001500| 6f 6e 20 66 6f 72 20 74 | 68 65 20 74 68 72 65 61 |on for t|he threa|
|00001510| 64 2e 20 2a 2f 0d 09 09 | 53 65 74 54 68 72 65 61 |d. */...|SetThrea|
|00001520| 64 54 65 72 6d 69 6e 61 | 74 6f 72 20 28 20 2a 74 |dTermina|tor ( *t|
|00001530| 68 72 65 61 64 4d 61 64 | 65 2c 20 6d 79 54 68 72 |hreadMad|e, myThr|
|00001540| 65 61 64 54 65 72 6d 69 | 6e 61 74 69 6f 6e 2c 20 |eadTermi|nation, |
|00001550| 6e 69 6c 20 29 3b 0d 09 | 09 0d 09 09 2f 2a 20 69 |nil );..|..../* i|
|00001560| 6e 63 72 65 6d 65 6e 74 | 20 74 68 65 20 74 6f 74 |ncrement| the tot|
|00001570| 61 6c 20 6e 75 6d 62 65 | 72 20 6f 66 20 73 75 62 |al numbe|r of sub|
|00001580| 2d 74 68 72 65 61 64 73 | 2e 20 2a 2f 0d 09 09 2b |-threads|. */...+|
|00001590| 2b 67 54 68 72 65 61 64 | 54 6f 74 61 6c 3b 0d 09 |+gThread|Total;..|
|000015a0| 09 0d 09 09 2f 2a 20 44 | 65 63 72 65 61 73 65 20 |..../* D|ecrease |
|000015b0| 74 68 65 20 73 6c 65 65 | 70 20 74 69 63 6b 73 20 |the slee|p ticks |
|000015c0| 73 6f 20 77 65 27 6c 6c | 20 74 61 6b 65 20 6d 6f |so we'll| take mo|
|000015d0| 72 65 20 70 72 6f 63 65 | 73 73 69 6e 67 20 74 69 |re proce|ssing ti|
|000015e0| 6d 65 2e 20 2a 2f 0d 09 | 09 67 53 6c 65 65 70 54 |me. */..|.gSleepT|
|000015f0| 69 63 6b 73 20 3d 20 6b | 53 6c 65 65 70 54 69 63 |icks = k|SleepTic|
|00001600| 6b 73 57 68 65 6e 42 75 | 73 79 3b 0d 09 7d 0d 09 |ksWhenBu|sy;..}..|
|00001610| 0d 09 72 65 74 75 72 6e | 20 74 68 65 45 72 72 3b |..return| theErr;|
|00001620| 0d 7d 20 2f 2a 20 4d 79 | 4e 65 77 54 68 72 65 61 |.} /* My|NewThrea|
|00001630| 64 46 72 6f 6d 50 6f 6f | 6c 20 2a 2f 0d 23 65 6e |dFromPoo|l */.#en|
|00001640| 64 69 66 0d 0d 0d 2f 2a | 20 54 68 65 20 54 68 72 |dif.../*| The Thr|
|00001650| 65 61 64 20 4d 61 6e 61 | 67 65 72 20 6d 75 73 74 |ead Mana|ger must|
|00001660| 20 62 65 20 61 76 61 69 | 6c 61 62 6c 65 20 66 6f | be avai|lable fo|
|00001670| 72 20 74 68 69 73 20 66 | 75 6e 63 74 69 6f 6e 20 |r this f|unction |
|00001680| 74 6f 20 77 6f 72 6b 2e | 20 2a 2f 0d 23 69 66 20 |to work.| */.#if |
|00001690| 6b 53 74 61 72 74 75 70 | 54 68 72 65 61 64 73 50 |kStartup|ThreadsP|
|000016a0| 72 65 61 6c 6c 6f 63 61 | 74 65 20 3e 20 6e 69 6c |realloca|te > nil|
|000016b0| 0d 70 61 73 63 61 6c 20 | 76 6f 69 64 0d 6d 79 54 |.pascal |void.myT|
|000016c0| 68 72 65 61 64 54 65 72 | 6d 69 6e 61 74 69 6f 6e |hreadTer|mination|
|000016d0| 20 28 20 54 68 72 65 61 | 64 49 44 20 74 68 72 65 | ( Threa|dID thre|
|000016e0| 61 64 54 65 72 6d 69 6e | 61 74 65 64 2c 20 76 6f |adTermin|ated, vo|
|000016f0| 69 64 20 2a 74 65 72 6d | 69 6e 61 74 69 6f 6e 50 |id *term|inationP|
|00001700| 72 6f 63 50 61 72 61 6d | 20 29 0d 7b 0d 09 4f 53 |rocParam| ).{..OS|
|00001710| 45 72 72 09 74 68 65 45 | 72 72 3b 0d 09 0d 09 23 |Err.theE|rr;....#|
|00001720| 69 66 20 6b 43 6f 6d 70 | 69 6c 65 57 69 74 68 54 |if kComp|ileWithT|
|00001730| 68 72 65 61 64 73 4f 70 | 74 69 6f 6e 61 6c 0d 09 |hreadsOp|tional..|
|00001740| 6d 79 5f 61 73 73 65 72 | 74 20 28 20 67 48 61 73 |my_asser|t ( gHas|
|00001750| 54 68 72 65 61 64 4d 67 | 72 2c 20 22 5c 70 6d 79 |ThreadMg|r, "\pmy|
|00001760| 54 68 72 65 61 64 54 65 | 72 6d 69 6e 61 74 69 6f |ThreadTe|rminatio|
|00001770| 6e 3a 20 54 68 72 65 61 | 64 20 4d 61 6e 61 67 65 |n: Threa|d Manage|
|00001780| 72 20 6e 6f 74 20 61 76 | 61 69 6c 61 62 6c 65 22 |r not av|ailable"|
|00001790| 20 29 3b 0d 09 23 65 6e | 64 69 66 0d 09 6d 79 5f | );..#en|dif..my_|
|000017a0| 61 73 73 65 72 74 20 28 | 20 67 54 68 72 65 61 64 |assert (| gThread|
|000017b0| 54 6f 74 61 6c 20 3e 20 | 6e 69 6c 2c 20 22 5c 70 |Total > |nil, "\p|
|000017c0| 6d 79 54 68 72 65 61 64 | 54 65 72 6d 69 6e 61 74 |myThread|Terminat|
|000017d0| 69 6f 6e 3a 20 67 54 68 | 72 65 61 64 54 6f 74 61 |ion: gTh|readTota|
|000017e0| 6c 20 69 73 20 74 6f 6f | 20 73 6d 61 6c 6c 22 20 |l is too| small" |
|000017f0| 29 3b 0d 09 0d 09 69 66 | 20 28 20 67 54 68 72 65 |);....if| ( gThre|
|00001800| 61 64 53 6c 65 65 70 65 | 72 20 21 3d 20 6e 69 6c |adSleepe|r != nil|
|00001810| 20 29 0d 09 7b 0d 09 09 | 2f 2a 20 57 61 6b 65 20 | )..{...|/* Wake |
|00001820| 75 70 20 74 68 65 20 73 | 6c 65 65 70 69 6e 67 20 |up the s|leeping |
|00001830| 74 68 72 65 61 64 20 73 | 6f 20 74 68 61 74 20 69 |thread s|o that i|
|00001840| 74 20 6d 61 79 20 62 65 | 20 63 61 6c 6c 65 64 20 |t may be| called |
|00001850| 77 68 65 6e 20 6f 74 68 | 65 72 20 74 68 72 65 61 |when oth|er threa|
|00001860| 64 73 20 79 69 65 6c 64 | 2e 20 2a 2f 0d 09 09 74 |ds yield|. */...t|
|00001870| 68 65 45 72 72 20 3d 20 | 53 65 74 54 68 72 65 61 |heErr = |SetThrea|
|00001880| 64 53 74 61 74 65 20 28 | 20 67 54 68 72 65 61 64 |dState (| gThread|
|00001890| 53 6c 65 65 70 65 72 2c | 20 6b 52 65 61 64 79 54 |Sleeper,| kReadyT|
|000018a0| 68 72 65 61 64 53 74 61 | 74 65 2c 20 6e 69 6c 20 |hreadSta|te, nil |
|000018b0| 29 3b 0d 09 09 0d 09 09 | 67 54 68 72 65 61 64 53 |);......|gThreadS|
|000018c0| 6c 65 65 70 65 72 20 3d | 20 6e 69 6c 3b 0d 09 7d |leeper =| nil;..}|
|000018d0| 0d 09 0d 09 2f 2a 20 4c | 6f 77 65 72 20 74 68 65 |..../* L|ower the|
|000018e0| 20 63 6f 75 6e 74 20 6f | 66 20 73 75 62 2d 74 68 | count o|f sub-th|
|000018f0| 72 65 61 64 73 2e 20 2a | 2f 0d 09 2d 2d 67 54 68 |reads. *|/..--gTh|
|00001900| 72 65 61 64 54 6f 74 61 | 6c 3b 0d 09 0d 09 69 66 |readTota|l;....if|
|00001910| 20 28 20 67 54 68 72 65 | 61 64 54 6f 74 61 6c 20 | ( gThre|adTotal |
|00001920| 3d 3d 20 6e 69 6c 20 29 | 0d 09 7b 0d 09 09 2f 2a |== nil )|..{.../*|
|00001930| 20 49 66 20 74 68 65 72 | 65 20 61 72 65 20 6e 6f | If ther|e are no|
|00001940| 20 6d 6f 72 65 20 74 68 | 72 65 61 64 73 2c 20 72 | more th|reads, r|
|00001950| 65 73 65 74 20 74 68 65 | 20 73 6c 65 65 70 20 74 |eset the| sleep t|
|00001960| 69 63 6b 73 20 74 6f 20 | 6e 6f 72 6d 61 6c 2e 20 |icks to |normal. |
|00001970| 2a 2f 0d 09 09 67 53 6c | 65 65 70 54 69 63 6b 73 |*/...gSl|eepTicks|
|00001980| 20 3d 20 6b 53 6c 65 65 | 70 54 69 63 6b 73 3b 0d | = kSlee|pTicks;.|
|00001990| 09 7d 0d 7d 20 2f 2a 20 | 6d 79 54 68 72 65 61 64 |.}.} /* |myThread|
|000019a0| 54 65 72 6d 69 6e 61 74 | 69 6f 6e 20 2a 2f 0d 23 |Terminat|ion */.#|
|000019b0| 65 6e 64 69 66 0d 0d 0d | 2f 2a 20 47 69 76 65 20 |endif...|/* Give |
|000019c0| 61 6c 6c 20 73 75 62 2d | 74 68 72 65 61 64 73 20 |all sub-|threads |
|000019d0| 61 20 63 68 61 6e 63 65 | 20 74 6f 20 66 69 6e 69 |a chance| to fini|
|000019e0| 73 68 20 2a 2f 0d 76 6f | 69 64 0d 54 68 72 65 61 |sh */.vo|id.Threa|
|000019f0| 64 46 69 6e 69 73 68 41 | 6c 6c 53 75 62 54 68 72 |dFinishA|llSubThr|
|00001a00| 65 61 64 73 20 28 20 76 | 6f 69 64 20 29 0d 7b 0d |eads ( v|oid ).{.|
|00001a10| 09 54 68 72 65 61 64 49 | 44 09 63 75 72 72 65 6e |.ThreadI|D.curren|
|00001a20| 74 54 68 72 65 61 64 3b | 0d 09 0d 09 23 69 66 20 |tThread;|....#if |
|00001a30| 6b 43 6f 6d 70 69 6c 65 | 57 69 74 68 54 68 72 65 |kCompile|WithThre|
|00001a40| 61 64 73 4f 70 74 69 6f | 6e 61 6c 0d 09 6d 79 5f |adsOptio|nal..my_|
|00001a50| 61 73 73 65 72 74 20 28 | 20 67 48 61 73 54 68 72 |assert (| gHasThr|
|00001a60| 65 61 64 4d 67 72 2c 20 | 22 5c 70 54 68 72 65 61 |eadMgr, |"\pThrea|
|00001a70| 64 46 69 6e 69 73 68 41 | 6c 6c 53 75 62 54 68 72 |dFinishA|llSubThr|
|00001a80| 65 61 64 73 3a 20 54 68 | 72 65 61 64 20 4d 61 6e |eads: Th|read Man|
|00001a90| 61 67 65 72 20 6e 6f 74 | 20 61 76 61 69 6c 61 62 |ager not| availab|
|00001aa0| 6c 65 22 20 29 3b 0d 09 | 23 65 6e 64 69 66 0d 09 |le" );..|#endif..|
|00001ab0| 0d 09 47 65 74 43 75 72 | 72 65 6e 74 54 68 72 65 |..GetCur|rentThre|
|00001ac0| 61 64 20 28 20 26 63 75 | 72 72 65 6e 74 54 68 72 |ad ( &cu|rrentThr|
|00001ad0| 65 61 64 20 29 3b 0d 09 | 0d 09 69 66 20 28 20 63 |ead );..|..if ( c|
|00001ae0| 75 72 72 65 6e 74 54 68 | 72 65 61 64 20 21 3d 20 |urrentTh|read != |
|00001af0| 67 54 68 72 65 61 64 4d | 61 69 6e 20 29 0d 09 7b |gThreadM|ain )..{|
|00001b00| 0d 09 09 2f 2a 20 6c 6f | 77 65 72 20 74 68 65 20 |.../* lo|wer the |
|00001b10| 63 6f 75 6e 74 20 6f 66 | 20 73 75 62 2d 74 68 72 |count of| sub-thr|
|00001b20| 65 61 64 73 20 74 6f 20 | 70 72 65 76 65 6e 74 20 |eads to |prevent |
|00001b30| 74 68 69 73 20 73 75 62 | 2d 74 68 72 65 61 64 20 |this sub|-thread |
|00001b40| 66 72 6f 6d 0d 09 09 09 | 70 72 65 76 65 6e 74 69 |from....|preventi|
|00001b50| 6e 67 20 74 68 65 20 65 | 78 69 74 20 6f 66 20 74 |ng the e|xit of t|
|00001b60| 68 65 20 77 68 69 6c 65 | 20 6c 6f 6f 70 20 62 65 |he while| loop be|
|00001b70| 6c 6f 77 20 2a 2f 0d 09 | 09 2d 2d 67 54 68 72 65 |low */..|.--gThre|
|00001b80| 61 64 54 6f 74 61 6c 3b | 0d 09 7d 0d 09 0d 09 77 |adTotal;|..}....w|
|00001b90| 68 69 6c 65 20 28 20 67 | 54 68 72 65 61 64 54 6f |hile ( g|ThreadTo|
|00001ba0| 74 61 6c 20 3e 20 6e 69 | 6c 20 29 0d 09 7b 0d 09 |tal > ni|l )..{..|
|00001bb0| 09 2f 2a 20 77 68 69 6c | 65 20 74 68 65 72 65 20 |./* whil|e there |
|00001bc0| 72 65 6d 61 69 6e 20 6f | 74 68 65 72 20 74 68 72 |remain o|ther thr|
|00001bd0| 65 61 64 73 20 28 6e 6f | 74 20 69 6e 63 6c 75 64 |eads (no|t includ|
|00001be0| 69 6e 67 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 |ing the |current |
|00001bf0| 61 6e 64 20 6d 61 69 6e | 29 2c 0d 09 09 09 6c 65 |and main|),....le|
|00001c00| 74 20 74 68 65 6d 20 66 | 69 6e 69 73 68 20 62 65 |t them f|inish be|
|00001c10| 66 6f 72 65 20 71 75 69 | 74 74 69 6e 67 20 2a 2f |fore qui|tting */|
|00001c20| 0d 09 09 59 69 65 6c 64 | 54 6f 41 6e 79 54 68 72 |...Yield|ToAnyThr|
|00001c30| 65 61 64 20 28 29 3b 0d | 09 7d 0d 09 0d 09 69 66 |ead ();.|.}....if|
|00001c40| 20 28 20 63 75 72 72 65 | 6e 74 54 68 72 65 61 64 | ( curre|ntThread|
|00001c50| 20 21 3d 20 67 54 68 72 | 65 61 64 4d 61 69 6e 20 | != gThr|eadMain |
|00001c60| 29 0d 09 7b 0d 09 09 2f | 2a 20 69 6e 63 72 65 61 |)..{.../|* increa|
|00001c70| 73 65 20 74 68 65 20 63 | 6f 75 6e 74 20 6f 66 20 |se the c|ount of |
|00001c80| 73 75 62 2d 74 68 72 65 | 61 64 73 20 2a 2f 0d 09 |sub-thre|ads */..|
|00001c90| 09 2b 2b 67 54 68 72 65 | 61 64 54 6f 74 61 6c 3b |.++gThre|adTotal;|
|00001ca0| 0d 09 7d 0d 7d 20 2f 2a | 20 54 68 72 65 61 64 46 |..}.} /*| ThreadF|
|00001cb0| 69 6e 69 73 68 41 6c 6c | 53 75 62 54 68 72 65 61 |inishAll|SubThrea|
|00001cc0| 64 73 20 2a 2f 0d 0d 0d | 23 69 66 20 30 0d 2f 2a |ds */...|#if 0./*|
|00001cd0| 20 70 6c 65 61 73 65 20 | 69 67 6e 6f 72 65 20 74 | please |ignore t|
|00001ce0| 68 69 73 20 66 75 6e 63 | 74 69 6f 6e 20 66 6f 72 |his func|tion for|
|00001cf0| 20 6e 6f 77 20 62 65 63 | 61 75 73 65 20 69 74 20 | now bec|ause it |
|00001d00| 69 73 20 69 6e 63 6f 6d | 70 6c 65 74 65 20 28 69 |is incom|plete (i|
|00001d10| 6e 20 70 72 6f 67 72 65 | 73 73 29 20 2a 2f 0d 4f |n progre|ss) */.O|
|00001d20| 53 45 72 72 0d 54 68 72 | 65 61 64 53 6c 65 65 70 |SErr.Thr|eadSleep|
|00001d30| 20 28 20 54 68 72 65 61 | 64 49 44 20 74 68 65 54 | ( Threa|dID theT|
|00001d40| 68 72 65 61 64 20 29 0d | 7b 0d 09 4f 53 45 72 72 |hread ).|{..OSErr|
|00001d50| 09 74 68 65 45 72 72 3b | 0d 09 0d 09 67 54 68 72 |.theErr;|....gThr|
|00001d60| 65 61 64 53 6c 65 65 70 | 65 72 5b 67 54 68 72 65 |eadSleep|er[gThre|
|00001d70| 61 64 53 6c 65 65 70 65 | 72 49 6e 64 65 78 5d 20 |adSleepe|rIndex] |
|00001d80| 3d 20 74 68 65 54 68 72 | 65 61 64 3b 0d 09 0d 09 |= theThr|ead;....|
|00001d90| 69 66 20 28 20 67 54 68 | 72 65 61 64 53 6c 65 65 |if ( gTh|readSlee|
|00001da0| 70 65 72 49 6e 64 65 78 | 20 3c 20 6b 53 74 61 72 |perIndex| < kStar|
|00001db0| 74 75 70 54 68 72 65 61 | 64 73 50 72 65 61 6c 6c |tupThrea|dsPreall|
|00001dc0| 6f 63 61 74 65 20 29 20 | 7b 0d 09 09 2b 2b 67 54 |ocate ) |{...++gT|
|00001dd0| 68 72 65 61 64 53 6c 65 | 65 70 65 72 49 6e 64 65 |hreadSle|eperInde|
|00001de0| 78 3b 0d 09 7d 20 65 6c | 73 65 20 7b 0d 09 09 67 |x;..} el|se {...g|
|00001df0| 54 68 72 65 61 64 53 6c | 65 65 70 65 72 49 6e 64 |ThreadSl|eeperInd|
|00001e00| 65 78 20 3d 20 30 3b 0d | 09 7d 0d 09 0d 09 69 66 |ex = 0;.|.}....if|
|00001e10| 20 28 20 67 54 68 72 65 | 61 64 53 6c 65 65 70 65 | ( gThre|adSleepe|
|00001e20| 72 20 21 3d 20 6e 69 6c | 20 29 0d 09 7b 0d 09 09 |r != nil| )..{...|
|00001e30| 2f 2a 20 70 75 74 20 74 | 68 65 20 63 75 72 72 65 |/* put t|he curre|
|00001e40| 6e 74 20 74 68 72 65 61 | 64 20 74 6f 20 73 6c 65 |nt threa|d to sle|
|00001e50| 65 70 2c 20 74 6f 20 62 | 65 20 77 6f 6b 65 6e 20 |ep, to b|e woken |
|00001e60| 75 70 20 77 68 65 6e 20 | 61 20 74 68 72 65 61 64 |up when |a thread|
|00001e70| 20 62 65 63 6f 6d 65 73 | 20 61 76 61 69 6c 61 62 | becomes| availab|
|00001e80| 6c 65 20 2a 2f 0d 09 09 | 74 68 65 45 72 72 20 3d |le */...|theErr =|
|00001e90| 20 53 65 74 54 68 72 65 | 61 64 53 74 61 74 65 20 | SetThre|adState |
|00001ea0| 28 20 67 54 68 72 65 61 | 64 53 6c 65 65 70 65 72 |( gThrea|dSleeper|
|00001eb0| 2c 20 6b 52 65 61 64 79 | 54 68 72 65 61 64 53 74 |, kReady|ThreadSt|
|00001ec0| 61 74 65 2c 20 6e 69 6c | 20 29 3b 0d 09 09 0d 09 |ate, nil| );.....|
|00001ed0| 09 67 54 68 72 65 61 64 | 53 6c 65 65 70 65 72 20 |.gThread|Sleeper |
|00001ee0| 3d 20 6e 69 6c 3b 0d 09 | 7d 0d 7d 20 2f 2a 20 54 |= nil;..|}.} /* T|
|00001ef0| 68 72 65 61 64 53 6c 65 | 65 70 20 2a 2f 0d 23 65 |hreadSle|ep */.#e|
|00001f00| 6e 64 69 66 0d 0d 2f 2a | 2a 2a 2a 2a 20 20 45 4f |ndif../*|**** EO|
|00001f10| 46 20 20 2a 2a 2a 2a 2a | 2f 0d 00 00 00 00 00 00 |F *****|/.......|
|00001f20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001f30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001f80| 00 00 01 00 00 00 01 54 | 00 00 00 54 00 00 00 46 |.......T|...T...F|
|00001f90| de 18 4e 90 2c 00 48 46 | 42 46 4a 86 59 8f 59 8f |..N.,.HF|BFJ.Y.Y.|
|00001fa0| 2f 06 2f 2e ff f8 a8 4d | 2f 2e ff fc a8 68 20 07 |/./....M|/....h .|
|00001fb0| 0d 50 72 6f 63 65 73 73 | 55 74 69 6c 2e 63 02 00 |.Process|Util.c..|
|00001fc0| 00 00 54 45 58 54 43 57 | 49 45 00 04 00 00 00 00 |..TEXTCW|IE......|
|00001fd0| 00 00 54 45 58 54 43 57 | 49 45 00 04 00 00 00 00 |..TEXTCW|IE......|
|00001fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001ff0| 00 00 aa 3f 49 91 00 00 | 00 00 00 00 01 9a e5 41 |...?I...|.......A|
|00002000| 37 80 10 00 ba 44 5d c3 | 44 03 67 04 30 04 60 02 |7....D].|D.g.0.`.|
|00002010| 30 05 22 07 e5 41 37 80 | 10 02 52 47 be 6d fe 5c |0."..A7.|..RG.m.\|
|00002020| 6d 00 ff 1c 7a 00 78 00 | 42 47 3b 6d fe 50 fe 4e |m...z.x.|BG;m.P.N|
|00002030| 20 6d de 18 4e 90 32 2d | fe 5c 48 c1 4e ba 07 ae | m..N.2-|.\H.N...|
|00002040| c0 bc 00 00 7f ff 3b 40 | fe 50 2c 05 20 05 e2 80 |......;@|.P,. ...|
|00002050| 2d 40 ff f0 59 8f 30 2d | fe 50 e9 40 2f 34 00 00 |-@..Y.0-|.P.@/4..|
|00002060| 2f 04 20 6d de 1c 4e 90 | 20 2e ff f0 22 1f d2 80 |/. m..N.| ..."...|
|00002070| 30 2d fe 50 e9 40 20 34 | 00 08 d0 81 2a 00 59 8f |0-.P.@ 4|....*.Y.|
|00002080| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....|
|00002090| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000020a0| 00 00 00 00 00 00 00 03 | 00 04 00 57 00 05 01 b4 |........|...W....|
|000020b0| 02 19 00 57 00 05 01 b4 | 02 19 ad 2d e3 7d 00 00 |...W....|...-.}..|
|000020c0| 00 00 00 00 00 00 00 00 | 00 00 01 00 00 00 00 04 |........|........|
|000020d0| 00 01 00 01 00 00 01 00 | 00 00 01 54 00 00 00 54 |........|...T...T|
|000020e0| 00 00 00 46 00 bc 8e d4 | 0f cc 00 00 00 1c 00 46 |...F....|.......F|
|000020f0| 00 01 4d 50 53 52 00 00 | 00 12 4d 57 42 42 00 00 |..MPSR..|..MWBB..|
|00002100| 00 1e 03 ed ff ff 00 00 | 00 00 00 00 00 00 03 f0 |........|........|
|00002110| ff ff 00 00 00 4c 00 00 | 00 00 00 00 00 00 00 00 |.....L..|........|
|00002120| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+